<?php PageUtil::addVar("stylesheet","<link href=\"".$stylepath."/brand.css\" rel=\"stylesheet\">");?>
<form action="<?php echo base_url('brand/admin_add'); ?>" method="post" class="form-horizontal" >
	<div class="content_block col-xs-12 col-sm-12 col-md-12 col-lg-12">		
		<h2>หมวดหมู่</h2>
		<?php
			$total = count($all_cats);
			$per_col = round((count($all_cats)/4));
			$count = 1;
			foreach ($all_cats as $catKey => $cat) {
				if(!empty($cat_foredit)){
					foreach ($cat_foredit as $key => $value) {
						if($cat["id"] == $value["cat_id"]){
							$checked = TRUE;
						}else{
							$checked = FALSE;
						}
					}
				}
				if($count==1){
					echo "<div class=\"column\">";
				}
		?>
			<div class ="value">
				<input type="checkbox" name="all_cat[]" value="<?php echo $cat["id"];?>"<?php if(!empty($cat_foredit)AND($checked == TRUE)){ ?> checked <?php } ?>> <?php echo $cat["name"]; ?>
			</div>
				<?php
					if(($count == $per_col)OR($total==$catKey+1)){
						echo"</div>";
						$count = 1;
					}else{
						$count++;
					}

				?>
		<?php
			}
		?>
		<h2>แบรนด์</h2>
		  	
			<div class="control-group">
				<label class="control-label" >แบรนด์</label>
				<div class="controls">
					<input type="hidden" name="id" value="<?php if(!empty($brand[0]['id'])) echo $brand[0]['id']; ?>">
					
					<input type="text" name="name" value="<?php if(!empty($brand[0]['name']))echo $brand[0]['name']; ?>" >
				</div>
			</div>

		<div class="control-group">
			<div class="controls">
				<button type="submit" class="btn btn-primary" id="submitbtn">Submit</button>
				<button type="reset" class="btn">Cancel</button>
			</div>
		</div>
	</div>
</form>